// custom-tab-bar/custom-tab-bar.js
Component({
	properties: {
		selected: {
			type:Number,
		}
	},
  data: {
    color: "#7A7E83",
    selectedColor: "#3cc51f",
    list: [],
    role: '',
	teacherBar: [
			{
				pagePath: "/pages/home/teacherHome/teacherHome",
				iconPath: "/images/zhuye.png",
				selectedIconPath: "/images/zhuye-active.png",
			},
			{
				pagePath: "/pages/message/teacherMessage/teacherMessage",
				iconPath: "/images/xiaoxi.png",
				selectedIconPath: "/images/xiaoxi-active.png",
			}
		],
		studentBar: [
			{
				pagePath: "/pages/home/studentHome/studentHome",
				iconPath: "/images/zhuye.png",
				selectedIconPath: "/images/zhuye-active.png",
			},
			{
				pagePath: "/pages/message/studentMessage/studentMessage",
				iconPath: "/images/xiaoxi.png",
				selectedIconPath: "/images/xiaoxi-active.png",
			}
		]
  },

	attached () {
		const role = wx.getStorageSync('role')
		const studentBar = this.data.studentBar
		const teacherBar = this.data.teacherBar
		this.setData({
			role: role
		})
		if (role == 'student' || role == '') {
			this.setData({
				list: studentBar
			})
		}
		else if (role == 'teacher') {
			this.setData({
				list: teacherBar
			})
		}
	},
  /**
   * 组件的方法列表
   */
	 
  methods: {
    switchTab(e) {
      const data = e.currentTarget.dataset
      const url = data.path
      wx.switchTab({url})
    }
  }
})